Post

Replies

Boosts

Views

Activity

Reply to CryptoSwift - Getting nil when using makeEncryptor() for string of less than 16 bytes in iOS
No, I don't want padding. I have done the same with Ruby, Java, Go, and others and none require padding or the input value to be a multiple of 16 bytes like the Swift library seems to require. const key = '12345678901234567890123456789012'; const iv = '000000000000' const cipher = crypto.createCipheriv('aes-256-gcm', key, iv);	 const plaintext = 'Hello';	 const ciphertext = cipher.update(plaintext, 'utf8');	 console.log("ciphertext length %d", ciphertext.length)	 cipher.final();	 const tag = cipher.getAuthTag(); const decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);	 decipher.setAuthTag(tag);	 const receivedPlaintext = decipher.update(ciphertext, null, 'utf8');	 try { 	decipher.final(); } catch (err) { 	console.error('Authentication failed!'); 	return; } console.log(receivedPlaintext);
Oct ’20